// -------------------------------------------
//					Paragraph
// -------------------------------------------

#include "Paragraph.h"

void Paragraph::addLine(const Line& line)
{
    _paragraph.push_back(line);
}

bool Paragraph::contains(const Word& search_word, vector<int>& line_numbers) const
{
    line_numbers.clear();
    bool notFound = true;
    bool found = false;
    //cout << "para size: " << _paragraph.size() << endl;
    if (_paragraph.empty())
    {
        cout << "para empty" << endl;
        return false;
    }


    for (int i=0; i< _paragraph.size(); i++ )
    {

        if(_paragraph[i].contains(search_word))
        {
            //cout << "paragraph word found" << endl;
            found = true;
            notFound = false;
            line_numbers.push_back(i+1);
        }
        else
        {
            //cout << "paragraph word not found" << endl;
        }

    }

    if (found == true)
    {
        return true;
    }

    if (notFound == true)
    {
        //cout << "paragraph word not found" << endl;
        return false;
    }

}
